from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer, Float, Date

# 创建对象的基类:
Base = declarative_base()


class FundTransaction(Base):
    # 表的名字:
    __tablename__ = 'FundUseTransactions'

    # 表的结构:
    id = Column(Integer, primary_key=True)
    # name = Column(String(50))
    # code = Column(String(50), nullable=False)
    FundId = Column(Integer)
    FundName = Column(String)
    BuyPrice = Column(Float)
    SellNumber = Column(Float)
    InFee = Column(Float)
    OutFee = Column(Float)
    # FloatValue = Column(Float)
    Remark = Column(String)
    SureTime = Column(Date)
    AddTime = Column(Date)
    State = Column(Integer)
    UserId = Column(Integer)

    def __repr__(self):
        return '<' + self.__tablename__ + '>{}:{}:{}'.format(self.UserId,self.FundId, self.FundName)

# def __init__(self, id, code, FundId, FundName, NetValue, FloatValue, Remark, GetTime, AddTime):
#     self.id = id
#     self.code = code
#     self.fundId = FundId
#     self.fundName = FundName
#     self.netValue = NetValue
#     self.floatValue = FloatValue
#     self.remark = Remark
#     self.getTime = GetTime
#     self.addTime = AddTime
